package ubiqweb.spring3.model;

import java.io.Serializable;

import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "user_info")
@SecondaryTable(name="user_login", 
				pkJoinColumns={@PrimaryKeyJoinColumn(name="user_id", referencedColumnName="user_id")})

		
		
public class Registration implements Serializable{
	
	@Id
	@GeneratedValue (strategy = GenerationType.IDENTITY)
	@Column(name = "user_id")
	private int userId;
	
	
	@NotEmpty
    @Size(min = 4, max = 50)
	@Column(table="user_login" , name="username")
	private String userName;
	
	@NotEmpty
	@Size(min = 4, max = 20)
	@Column(table="user_login", name="password")
	private String password;
	
	@Transient
	@NotEmpty
	private String confirmPassword;
	
	@NotEmpty
	@Column(name = "last_name")
	private String lastName;

	@NotEmpty
	@Column(name = "first_name")
	private String firstName;

	@NotEmpty
	@Column(name = "middle_name")
	private String middleName;

	@NotEmpty
	@DateTimeFormat
	@Column(name = "birthdate")
	private String birthDate;
	
	@NotEmpty
	@Column(name = "gender")
	private String gender;	
	
	@NotEmpty
	@Email
	@Column(name = "email_add")
	private String email;
	
	@Size(min = 11, max = 11)
	@Column(name = "mobile_no")
	private String mobileNum;
	
	@Size(min = 7, max = 7)
	@Column(name = "tel_no")
	private String telNum;
	
	@NotEmpty
	@Column(name = "address")
	private String address;
	
	@NotEmpty
	@Column(name = "id_type")
	private String idType;
	
	@NotEmpty
	@Column(name = "id_number")
	private String idNum;
	
	@Column(table="user_login", name="user_type")
	
	private String userType;

	public int getUserId() {
		return userId;
	}


	
	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getConfirmPassword() {
		return confirmPassword;
	}

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getMiddleName() {
		return middleName;
	}

	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}

	public String getBirthDate() {
		return birthDate;
	}

	public void setBirthDate(String birthDate) {
		this.birthDate = birthDate;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobileNum() {
		return mobileNum;
	}

	public void setMobileNum(String mobileNum) {
		this.mobileNum = mobileNum;
	}

	public String getTelNum() {
		return telNum;
	}

	public void setTelNum(String telNum) {
		this.telNum = telNum;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getIdType() {
		return idType;
	}

	public void setIdType(String idType) {
		this.idType = idType;
	}

	public String getIdNum() {
		return idNum;
	}

	public void setIdNum(String idNum) {
		this.idNum = idNum;
	}

	
	public void setUserType(String userType){
		this.userType = userType;
	}
	public String getUserType(){
		return userType;
	}
}